package com.module.comm.constants;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.system.comm.utils.FrameStringUtil;

public class ConfigCons {

	/**
	 * 项目名称
	 */
	public static String projectName;
	
	/**
	 * 是否启动项目检测
	 */
	public static Integer isMonitorProject;
	/**
	 * 是否启动客户端检测
	 */
	public static Integer isMonitorClient;
	/**
	 * 是否启动接口统计检测(0否、1是)
	 */
	public static Integer isMonitorRest;
	
	public static String restRmiHost;
	public static Integer restRmiPort;
	
	
	public static String serverRmiHost;
	public static Integer serverRmiPort;
	
	/**
	 * 服务信息
	 */
	private static String serverRmiInfos;
	
	/**
	 * 获取rmi服务端
	 * @return
	 */
	public static List<Map<String, Object>> getRmiServers() {
		List<Map<String, Object>> rmiServers = new ArrayList<Map<String,Object>>();
		if(FrameStringUtil.isNotEmpty(serverRmiInfos)) {
			List<String> list = FrameStringUtil.toArray(serverRmiInfos, ";");
			for (String string : list) {
				if(FrameStringUtil.isNotEmpty(string)) {
					List<String> info = FrameStringUtil.toArray(string, ":");
					if(info.size() == 2) {
						Map<String, Object> map = new HashMap<String, Object>();
						map.put("host", info.get(0));
						map.put("port", info.get(1));
						rmiServers.add(map);
					}
				}
			}
		}
		return rmiServers;
	}
	
	public static String getProjectName() {
		return projectName;
	}
	public static void setProjectName(String projectName) {
		ConfigCons.projectName = projectName;
	}
	public static Integer getIsMonitorProject() {
		return isMonitorProject;
	}
	public static void setIsMonitorProject(Integer isMonitorProject) {
		ConfigCons.isMonitorProject = isMonitorProject;
	}
	public static Integer getIsMonitorClient() {
		return isMonitorClient;
	}
	public static void setIsMonitorClient(Integer isMonitorClient) {
		ConfigCons.isMonitorClient = isMonitorClient;
	}
	public static String getRestRmiHost() {
		return restRmiHost;
	}
	public static void setRestRmiHost(String restRmiHost) {
		ConfigCons.restRmiHost = restRmiHost;
	}
	public static Integer getRestRmiPort() {
		return restRmiPort;
	}
	public static void setRestRmiPort(Integer restRmiPort) {
		ConfigCons.restRmiPort = restRmiPort;
	}
	public static String getServerRmiInfos() {
		return serverRmiInfos;
	}
	public static void setServerRmiInfos(String serverRmiInfos) {
		ConfigCons.serverRmiInfos = serverRmiInfos;
	}
	public static String getServerRmiHost() {
		return serverRmiHost;
	}
	public static void setServerRmiHost(String serverRmiHost) {
		ConfigCons.serverRmiHost = serverRmiHost;
	}
	public static Integer getServerRmiPort() {
		return serverRmiPort;
	}
	public static void setServerRmiPort(Integer serverRmiPort) {
		ConfigCons.serverRmiPort = serverRmiPort;
	}
	public static Integer getIsMonitorRest() {
		return isMonitorRest;
	}
	public static void setIsMonitorRest(Integer isMonitorRest) {
		ConfigCons.isMonitorRest = isMonitorRest;
	}
}